Add additional math methods#140
Conversation
| return (value - start) / (stop - start) | ||
|
|
||
|
|
||
| def remap(value, start1, stop1, start2, stop2): |
There was a problem hiding this comment.
Not a blocker but we could potentially add the optional 6th argument from p5.js's version of the map() function: map(value, start1, stop1, start2, stop2, [withinBounds]) where withinBounds is a boolean which (if true) makes the function constrain the return value to the newly mapped range.
|
Could we explicitly address the tradeoffs before making a decision on From issue #131 it seems like there are at least two possible directions:
Note: we should document this type of decisions on GitHub, since not everyone is on Discord and messages there are not publicly available without an account. |
| @@ -0,0 +1,69 @@ | |||
| """Processing math methods and vector/quaternion types.""" | |||
There was a problem hiding this comment.
There was a problem hiding this comment.
I should leave a comment to make this clear, but these are available in the global python namespace and I believe match processing semantics already.
Ex:
[I] char@mbp ~/s/g/p/libprocessing $ python3 compute-2
Python 3.14.4 (main, Apr 7 2026, 13:13:20) [Clang 17.0.0 (clang-1700.6.4.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> round
<built-in function round>
I feel pretty strongly that shadowing built-ins is the wrong decision. |
I want to second this. We don't want to clobber the python ecosystem in being overly opinionated. If this somehow becomes an issue to downstream users we can address it then. is this ready? |
Closes #135
We're going with
remapas noted here: https://discord.com/channels/1076634729618624534/1473643112512491692/1496498755028127905